const mongoose = require("mongoose")

const userSchema = new mongoose.Schema({
  username: { type: String },
  password: {
    type: String,
    set(val) {
      return require("bcryptjs").hashSync(val, 8)
    },
  },
})

const UserModel = mongoose.model("user", userSchema)

module.exports = UserModel
